using System;
using EPiServer.Common;
using EPiServer.Common.Queries;
using EPiServer.Common.Rating;
using EPiServer.Common.Security;

namespace EPiAbstractions.Common.Rating
{
    public interface IRatingHandlerFacade
    {
        RatableEntityCollection GetRatedItems(Double rating, Int32 page, Int32 pageSize, out Int32 totalItems);

        RatableEntityCollection GetRatedItems(Type type, Double rating, Int32 page, Int32 pageSize, out Int32 totalItems);

        RatableEntityCollection GetRatedItems(Double minRating, Double maxRating, Int32 page, Int32 pageSize, out Int32 totalItems);

        RatableEntityCollection GetRatedItems(Type type, Double minRating, Double maxRating, Int32 page, Int32 pageSize,
                                              out Int32 totalItems);

        RatableEntityCollection GetRatedItems(SiteCollection sites, NullValueAction siteNullAction, Double rating, Int32 page,
                                              Int32 pageSize, out Int32 totalItems);

        RatableEntityCollection GetRatedItems(Type type, SiteCollection sites, NullValueAction siteNullAction, Double rating, Int32 page,
                                              Int32 pageSize, out Int32 totalItems);

        RatableEntityCollection GetRatedItems(SiteCollection sites, NullValueAction siteNullAction, Double minRating, Double maxRating,
                                              Int32 page, Int32 pageSize, out Int32 totalItems);

        RatableEntityCollection GetRatedItems(Type type, SiteCollection sites, Double minRating, Double maxRating, Int32 page,
                                              Int32 pageSize, out Int32 totalItems);

        RatableEntityCollection GetRatedItems(Type type, SiteCollection sites, NullValueAction siteNullAction, Double minRating,
                                              Double maxRating, Int32 page, Int32 pageSize, out Int32 totalItems);

        IRating GetRating(IRatableEntity ratable, IAuthor author);

        RatingCollection GetRatings(IAuthor author, Int32 page, Int32 pageSize, out Int32 totalItems);

        RatingCollection GetRatings(Type type, IAuthor author, Int32 page, Int32 pageSize, out Int32 totalItems);

        RatingCollection GetRatings(IAuthor author, Double rating, Int32 page, Int32 pageSize, out Int32 totalItems);

        RatingCollection GetRatings(Type type, IAuthor author, Double rating, Int32 page, Int32 pageSize, out Int32 totalItems);

        RatingCollection GetRatings(IAuthor author, Double minRating, Double maxRating, Int32 page, Int32 pageSize, out Int32 totalItems);

        RatingCollection GetRatings(Type type, IAuthor author, Double minRating, Double maxRating, Int32 page, Int32 pageSize,
                                    out Int32 totalItems);

        RatingCollection GetRatings(IRatableEntity ratable, Int32 page, Int32 pageSize, out Int32 totalItems);

        RatingCollection GetRatings(IRatableEntity ratable, IAuthor author, Int32 page, Int32 pageSize, out Int32 totalItems);

        RatingCollection GetRatings(IRatableEntity ratable, Double rating, Int32 page, Int32 pageSize, out Int32 totalItems);

        RatingCollection GetRatings(IRatableEntity ratable, IAuthor author, Double rating, Int32 page, Int32 pageSize, out Int32 totalItems);

        RatingCollection GetRatings(IRatableEntity ratable, Double minRating, Double maxRating, Int32 page, Int32 pageSize,
                                    out Int32 totalItems);

        RatingCollection GetRatings(IRatableEntity ratable, IAuthor author, Double minRating, Double maxRating, Int32 page, Int32 pageSize,
                                    out Int32 totalItems);

        PopularRatableEntityCollection GetMostPopularItems(Int32 minimumVotesRequired, Int32 page, Int32 pageSize);

        PopularRatableEntityCollection GetMostPopularItems(Type objectType, Int32 minimumVotesRequired, Int32 page, Int32 pageSize);

        PopularRatableEntityCollection GetMostPopularItems(Type objectType, Int32 minimumVotesRequired, Int32 page, Int32 pageSize,
                                                           out Int32 totalItems);

        PopularRatableEntityCollection GetMostPopularItems(Type objectType, Int32 minimumVotesRequired, Int32 page, Int32 pageSize,
                                                           TimeSpan? explicitCacheExpiration, out Int32 totalItems);

        RatingCollection GetUsersRatedItems(UserCollection users, Int32 page, Int32 pageSize);

        RatingCollection GetUsersRatedItems(UserCollection users, Int32 page, Int32 pageSize, out Int32 totalItems);

        RatingCollection GetUsersRatedItems(UserCollection users, Int32 page, Int32 pageSize, out Int32 totalItems, Type objectType);

        Boolean HasRated(IRatableEntity ratable, IAuthor author);

        void Rate(IRating rating);

        void GetRatableEntityValues(IRatableEntity ratable, out Boolean isRatable, out Int32 numRatings, out Double sumRatings,
                                    out ISite site);

        IRating GetRating(Int32 id);
    }
}